package com.controller.hpt;

import com.service.hpt.RegisterBookService;
import com.util.gzp.AjaxResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping
public class RegisterBookController {

    @Resource
  private   RegisterBookService registerBookService;

   //查询所有的登记簿信息
   @GetMapping("/getAllRegisterBook")
   @ResponseBody
    public AjaxResponse getAllRegisterBook(){
        AjaxResponse registerBookList = registerBookService.getAllRegisterBook();
        System.out.println("RegisterBookController.getAllRegisterBook:+"+registerBookList);
        return registerBookList;

    }

//    根据登记簿编号查询登记簿
    @GetMapping("/getRegisterBook")
    @ResponseBody
    public AjaxResponse getRegisterBook( String registerBookNo){
        System.out.println("后台拿到的编号 = " + registerBookNo);
        AjaxResponse registerBookList= registerBookService.getRegisterBook(Integer.parseInt(registerBookNo));

        return registerBookList;

    }
//
//    //根据登记簿编号删除登记簿
    @GetMapping("/delRegisterBook")
    @ResponseBody
    public AjaxResponse delRegisterBook( String registerBookNo){
        System.out.println("registerBookNo = " + registerBookNo);
//        System.out.println("ccccccccccccccccccccccccc");
        AjaxResponse flag = registerBookService.delRegisterBook(Integer.parseInt(registerBookNo));
//        System.out.println("1111111111111111111111111:+"+flag);
        return flag;

    }



}
